import request from '@/config/axios'

export interface time {
  hour?: number
  minute?: number
  second?: number
  nano?: number
}

export interface Store {
  id?: number
  name?: string // 门店名称
  introduction?: string // 门店简介
  phone: string // 联系电话
  areaId?: number // 区域编号
  detailAddress?: string // 门店详细地址
  logo?: string // logo
  openingTime?: time // 营业开始时间
  closingTime?: time // 营业结束时间
  latitude?: number // 纬度
  longitude?: number // 经度
  status?: number // 门店状态
}

// 获得门店列表
export const getStoreList = (params: PageParam) => {
  return request.get({ url: '/trade/delivery/pick-up-store/page', params })
}

// 创建门店
export const createStore = (data: Store) => {
  return request.post({ url: '/trade/delivery/pick-up-store/create', data })
}

// 更新门店
export const updateStore = (data: Store) => {
  return request.put({ url: '/trade/delivery/pick-up-store/update', data })
}

// 获得门店 详情列表
export const getStoreDetail = (id: number) => {
  return request.get({ url: `/trade/delivery/pick-up-store/get?id=${id}` })
}

// 删除门店
export const deleteStore = (id: number) => {
  return request.delete({ url: `/trade/delivery/pick-up-store/delete?id=${id}` })
}
